home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / glowing-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  3.5 KB  |  111 lines

  1. ;  GLOWING
  2. ;  Create a text effect that simulates a glowing hot logo
  3.  
  4. (define (apply-glowing-logo-effect img
  5.                    logo-layer
  6.                    size
  7.                    bg-color)
  8.   (let* ((grow (/ size 4))
  9.      (feather1 (/ size 3))
  10.      (feather2 (/ size 7))
  11.      (feather3 (/ size 10))
  12.      (width (car (gimp-drawable-width logo-layer)))
  13.      (height (car (gimp-drawable-height logo-layer)))
  14.      (posx (- (car (gimp-drawable-offsets logo-layer))))
  15.      (posy (- (cadr (gimp-drawable-offsets logo-layer))))
  16.      (glow-layer (car (gimp-layer-copy logo-layer TRUE)))
  17.      (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE))))
  18.  
  19.     (gimp-context-push)
  20.  
  21.     (script-fu-util-image-resize-from-layer img logo-layer)
  22.     (gimp-image-add-layer img bg-layer 1)
  23.     (gimp-image-add-layer img glow-layer 1)
  24.     (gimp-layer-translate glow-layer posx posy)
  25.  
  26.     (gimp-selection-none img)
  27.     (gimp-context-set-background bg-color)
  28.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  29.  
  30.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  31.     (gimp-context-set-background '(0 0 0))
  32.     (gimp-edit-fill logo-layer BACKGROUND-FILL)
  33.  
  34.     (gimp-selection-layer-alpha logo-layer)
  35.     (gimp-selection-feather img feather1)
  36.     (gimp-context-set-background '(221 0 0))
  37.     (gimp-edit-fill glow-layer BACKGROUND-FILL)
  38.     (gimp-edit-fill glow-layer BACKGROUND-FILL)
  39.     (gimp-edit-fill glow-layer BACKGROUND-FILL)
  40.  
  41.     (gimp-selection-layer-alpha logo-layer)
  42.     (gimp-selection-feather img feather2)
  43.     (gimp-context-set-background '(232 217 18))
  44.     (gimp-edit-fill glow-layer BACKGROUND-FILL)
  45.     (gimp-edit-fill glow-layer BACKGROUND-FILL)
  46.  
  47.     (gimp-selection-layer-alpha logo-layer)
  48.     (gimp-selection-feather img feather3)
  49.     (gimp-context-set-background '(255 255 255))
  50.     (gimp-edit-fill glow-layer BACKGROUND-FILL)
  51.     (gimp-selection-none img)
  52.  
  53.     (gimp-layer-set-mode logo-layer OVERLAY-MODE)
  54.     (gimp-drawable-set-name glow-layer "Glow Layer")
  55.  
  56.     (gimp-context-pop)))
  57.  
  58.  
  59. (define (script-fu-glowing-logo-alpha img
  60.                       logo-layer
  61.                       size
  62.                       bg-color)
  63.   (begin
  64.     (gimp-image-undo-group-start img)
  65.     (apply-glowing-logo-effect img logo-layer size bg-color)
  66.     (gimp-image-undo-group-end img)
  67.     (gimp-displays-flush)))
  68.  
  69. (script-fu-register "script-fu-glowing-logo-alpha"
  70.             _"Glo_wing Hot..."
  71.             "Glowing hot logos"
  72.             "Spencer Kimball"
  73.             "Spencer Kimball"
  74.             "1997"
  75.             "RGBA"
  76.                     SF-IMAGE      "Image"                     0
  77.                     SF-DRAWABLE   "Drawable"                  0
  78.             SF-ADJUSTMENT _"Effect size (pixels * 3)" '(150 2 1000 1 10 0 1)
  79.             SF-COLOR      _"Background color"         '(7 0 20))
  80.  
  81. (script-fu-menu-register "script-fu-glowing-logo-alpha"
  82.              _"<Image>/Script-Fu/Alpha to Logo")
  83.  
  84.  
  85. (define (script-fu-glowing-logo text
  86.                 size
  87.                 font
  88.                 bg-color)
  89.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  90.      (border (/ size 4))
  91.      (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
  92.     (gimp-image-undo-disable img)
  93.     (apply-glowing-logo-effect img text-layer size bg-color)
  94.     (gimp-image-undo-enable img)
  95.     (gimp-display-new img)))
  96.  
  97. (script-fu-register "script-fu-glowing-logo"
  98.             _"Glo_wing Hot..."
  99.             "Glowing hot logos"
  100.             "Spencer Kimball"
  101.             "Spencer Kimball"
  102.             "1997"
  103.             ""
  104.             SF-STRING     _"Text"               "GLOWING"
  105.             SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
  106.             SF-FONT       _"Font"               "Slogan"
  107.             SF-COLOR      _"Background color"   '(7 0 20))
  108.  
  109. (script-fu-menu-register "script-fu-glowing-logo"
  110.              _"<Toolbox>/Xtns/Script-Fu/Logos")
  111.